﻿<div class="form-group col-12 col-sm-6">
    <Select TValue="string" Color="Color.Primary" Items="@Items" 
        OnSelectedItemChanged="@OnCascadeBindSelectClick">
    </Select>
</div>
<div class="form-group col-12 col-sm-6">
    <Select TValue="string" @ref="SubSelect" Color="Color.Success">
    </Select>
</div>

@code {
    /// <summary>
    /// 级联绑定菜单
    /// </summary>
    /// <param name="item"></param>
    protected void OnCascadeBindSelectClick(SelectedItem item)
    {
        _item2.Clear();
        if (item.Value == "Beijing")
        {
            _item2.AddRange(new SelectedItem[]
            {
                new SelectedItem("1","朝阳区"),
                new SelectedItem("2","海淀区"),
            });
        }
        else if (item.Value == "Shanghai")
        {
            _item2.AddRange(new SelectedItem[]
            {
                new SelectedItem("1","静安区"),
                new SelectedItem("2","黄浦区"),
            });
        }
    }
}
